<?php
/* @var $this ProjectItemController */
/* @var $model ProjectItem */

$this->breadcrumbs=array(
	'Project Items'=>array('index'),
	$model->id,
);

$this->menu=array(
	array('label'=>'List ProjectItem', 'url'=>array('index')),
	array('label'=>'Create ProjectItem', 'url'=>array('create')),
	array('label'=>'Update ProjectItem', 'url'=>array('update', 'id'=>$model->id)),
	array('label'=>'Delete ProjectItem', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>'Are you sure you want to delete this item?')),
	array('label'=>'Manage ProjectItem', 'url'=>array('admin')),
);
?>



<h1>Project Item #<?php echo $model->id; ?></h1>

<?php $this->widget('zii.widgets.CDetailView', array(
	'data'=>$model,
	'attributes'=>array(
		'id',
		array('label'=>'Project', 'value'=>$model->project->project_name),
		array('label'=>'Item', 'value'=>$model->item->item_desc),
		array('label' => 'Qty Request', 'value' => $model->qty_request .' '. $model->item->unit ),
		array('label' => 'Total Request Amount', 'value' => 'Php '. $model->qty_request * $model->item->unit_price ),
		array('label' => 'Qty Used', 'value' => $model->qty_used .' '. $model->item->unit ),
		array('label' => 'Total Used Amount', 'value' => 'Php '. $model->qty_used * $model->item->unit_price ),
		array('label' => 'Total Savings', 'value' => 'Php '. (($model->qty_request * $model->item->unit_price) - ($model->qty_used * $model->item->unit_price))),
	),
)); ?>


<?php $en=projectItem::model()->findAll('id = :a', array(':a'=>$model->id));?>
<?php if (count($en) !== 0){?>
<br>
<h2>Project</h2>
<?php foreach ($en as $row) { ?>
<?php echo CHtml::link ( 'Update', array('project/update', 'id'=>$row->project_id)); ?>
<?php $this->widget ('zii.widgets.CdetailView', array('data'=>$row,'attributes'=>array(
array('label'=>'Project Name By' , 'value'=>$row->project->project_name),
array('label'=>'Point Person' , 'value'=>$row->project->point_person),
array('label'=>'Start Date' , 'value'=>$row->project->start_date),
array('label'=>'End Date' , 'value'=>$row->project->end_date),),));?><br>
<?php }} ?>


<?php $en=projectItem::model()->findAll('id = :a', array(':a'=>$model->id));?>
<?php if (count($en) !== 0){?>
<br>
<h2>Item</h2>
<?php foreach ($en as $row) { ?>
<?php echo CHtml::link ( 'Update', array('item/update', 'id'=>$row->item_id)); ?>
<?php $this->widget ('zii.widgets.CdetailView', array('data'=>$row,'attributes'=>array(
array('label'=>'Item Description' , 'value'=>$row->item->item_desc),
array('label'=>'Category' , 'value'=>$row->item->category),
array('label'=>'Brand' , 'value'=>$row->item->brand),
array('label'=>'Code' , 'value'=>$row->item->item_code),
array('label'=>'Color' , 'value'=>$row->item->color),
array('label'=>'Unit' , 'value'=>$row->item->unit),
array('label'=>'Unit Price' , 'value'=> 'Php '. $row->item->unit_price),),));?><br>
<?php }} ?>
